package _const

import "fmt"

type GameId = string
type GameIdInt = int64

const (

	// 体验场MatchLevel
	TiYanMatchLevel = uint32(0)
	// 斗地主
	GameIdIntDoudizhu GameIdInt = 100
	// 血战到底
	GameIdIntXuezhandoadi = 117
	// 疯狂斗地主
	GameIdIntFKDoudizhu = 118
	// 血流成河麻将
	GameIdIntXueLiuChengHe = 119
	// 血战麻将
	GameIdIntXueZhanMaJiang = 120
)

var (
	//保存Game id 用于遍历
	gameIds = map[int64]interface{}{
		GameIdIntDoudizhu:       nil,
		GameIdIntXuezhandoadi:   nil,
		GameIdIntFKDoudizhu:     nil,
		GameIdIntXueLiuChengHe:  nil,
		GameIdIntXueZhanMaJiang: nil,
	}

	GameID_Doudizhu       GameId = fmt.Sprintf("%d", GameIdIntDoudizhu)       //斗地主
	GameID_Xuezhandaodi   GameId = fmt.Sprintf("%d", GameIdIntXuezhandoadi)   //血戰到底麻將
	GameID_FkDoudizhu     GameId = fmt.Sprintf("%d", GameIdIntFKDoudizhu)     //斗地主
	GameID_XueLiuChengHe  GameId = fmt.Sprintf("%d", GameIdIntXueLiuChengHe)  //血流成河麻将
	GameID_XueZhanMajiang GameId = fmt.Sprintf("%d", GameIdIntXueZhanMaJiang) //血流成河麻将
)

func init() {

}

//遍历GameId
func RangeGameId(f func(id int64) bool) {
	for k, _ := range gameIds {
		if !f(k) {
			break
		}
	}
}

//根據游戏获取一桌人数
//TODO： 之后改变为配置
func PlayerCount(gameId int64) int {
	switch gameId {
	case GameIdIntDoudizhu:
		return 3
	case GameIdIntXuezhandoadi:
		return 4
	}
	return 0
}

//根據游戲Id獲取服務類型
func ServerKind(gameID string) string {
	switch gameID {
	case GameID_Doudizhu:
		return "doudizhu"
	case GameID_Xuezhandaodi:
		return "xuezhandaodi"
	}
	return ""
}

//根據游戲Id獲取服務類型
func GetGameID(gameKind string) string {
	switch gameKind {
	case "doudizhu":
		return GameID_Doudizhu
	case "xuezhandaodi":
		return GameID_Xuezhandaodi
	}
	return ""
}
